{% case page.layout %}
{% when 'index' %}
  {% capture title %}{{ site.title }}{% if site.index_with_subtitle and site.subtitle %} - {{site.subtitle }}{% endif %}{% endcapture %}
{% when 'post' %}
  {% capture title %}{{ page.title }} | {{ site.title }}{% endcapture %}
{% when 'page' %}
  {% capture title %}
    {% assign page_title_suffix = ' | ' | append: site.title %}
    {% if page.type == "categories" and page.title == nil %}
      {{ __.title.category | append: page_title_suffix }}
    {% elsif page.type == "tags" and page.title == nil %}
      {{ __.title.tag | append: page_title_suffix }}
    {% else %}
      {{ page.title | append: page_title_suffix }}
    {% endif %}
  {% endcapture %}
{% when 'archive' %}
  {% capture title %}{{ __.title.archive }} | {{ site.title }}{% endcapture %}
{% when 'category' %}
  {% capture title %}{{ __.title.category }} | {{ site.title }}{% endcapture %}
{% when 'tag' %}
  {% capture title %}{{ __.title.tag }} | {{ site.title }}{% endcapture %}
{% when 'schedule' %}
  {% capture title %}{{ __.title.schedule }} | {{ site.title }}{% endcapture %}
{% endcase %}

{% assign title = title | strip_newlines %}
